<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <?php $this->load->view('user/_html_head') ?> 
	<script type="text/javascript">
      function hightlight(word, tab, selector){
        var temp = jQuery(selector).find(tab);
        var regex = new RegExp(word, "gi");
        for(var i = 0; i < temp.length; i ++ ){          
          jQuery(temp[i]).html(jQuery(temp[i]).html().replace(regex, '<code>'+word+'</code>'));

        }
        jQuery(selector).find('code').fadeIn("slow");
        jQuery('code').css('font-family', 'inherit');
      }
      <?php if(!empty($keyword)) { ?>
      jQuery(document).ready(function(){        
        hightlight('<?php echo $keyword ?>','.desc','.w400');
        hightlight('<?php echo $keyword ?>','a','.title');        
      });
      <?php } ?>
    </script>
	<style type="text/css">
    code{
        color:#04aef4;
        font-weight: bold;
      }
	</style>
	<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
  </head>
  <body>
    <div id="fb-root"></div>
    <script>
	  window.fbAsyncInit = function() { FB.init({appId: '289823484465602', status: true, cookie: true, xfbml: true}); };
	    (function() {
		  var e = document.createElement('script'); e.async = true;
		  e.src = document.location.protocol + '//connect.facebook.net/en_US/all.js';
		  document.getElementById('fb-root').appendChild(e);
	  }());
	</script>
    <div class="wrapper_screen">
      <div class="wrapper_main">
        <?php $this->load->view('user/_header') ?>
        <div class="contenu">        
          <script type="text/javascript">
          <?php foreach ($promotions as $promotion) { ?>
            var time_<?php echo $promotion['id'] ?> = <?php echo $promotion['end_date'] - time() ?>;
            jQuery(document).ready(function(){
              $('#slideshow_<?php echo $promotion['id'] ?>').cycle({fx: 'fade'});
            });
          <?php } ?>
            jQuery(document).ready(function(){                
              setInterval(function() {
              <?php foreach ($promotions as $promotion) { ?>
                setTimeAuction( "#remain_time_<?php echo $promotion['id'] ?>" , time_<?php echo $promotion['id'] ?> );
                    time_<?php echo $promotion['id'] ?> -= 1;
              <?php } ?>
              }, 1000);              
            });
          </script>
          <div style="float: left;width: 762px">
          <?php foreach ($promotions as $i => $promotion) {
              $this->load->view('user/_promotions', array('promotion' => $promotion, 'i' => $i));
            } ?>
            <div class="paging_page" style="width: 100%;float:left"><?php echo $paging ?></div>
          </div>
          <?php echo $this->load->view('user/_right_index') ?>          
        </div>
      </div>
    </div>
    <?php echo $this->load->view('user/_footer') ?>    
  </body>
</html>
